<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var fruit = ['苹果'];
        var food = ['白菜']
        fruit.push('香蕉') // push方法在末尾添加
        fruit.unshift('八角') //unshift 方法在加在第一个
        fruit.pop(); //删除末尾
        fruit.shift(); //删除第一个
        fruit.push('香蕉','橘子','芭蕉')

        //遍历
        for(i=0;i<fruit.length;i++){
            console.log(fruit[i]);
        }
        console.log(fruit)

        
    </script>
</head>
<body>
    
</body>
</html>